{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!--BOOK_INFORMATION-->\n",
    "<img align=\"left\" style=\"padding-right:10px;\" src=\"figures/PHydro-cover-small.png\">\n",
    "*This is the Jupyter notebook version of the [Python in Hydrology](http://www.greenteapress.com/pythonhydro/pythonhydro.html) by Sat Kumar Tomer.*\n",
    "*Source code is available at [code.google.com](https://code.google.com/archive/p/python-in-hydrology/source).*\n",
    "\n",
    "*The book is available under the [GNU Free Documentation License](http://www.gnu.org/copyleft/fdl.html). If you have comments, corrections or suggestions, please send email to satkumartomer@gmail.com.*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!--NAVIGATION-->\n",
    "< [Appendix B: Install library](11.00-Install library.ipynb) | [Contents](Index.ipynb) |  >"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## B.1 Basemap\n",
    "\n",
    "使用`pip`来安装新库看起来很简单，但实际上这并不是这样的。每个库有自己的依赖项，以及获取这些依赖项的方法，因此需要特殊的方法来安装它们。我们在地图中使用了`Basemap`。所以让我们安装这个库。这个库能够从`http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/`下载。从这个网站链接中下载最新的版本。有一些`*.exe`意味着呀安装在Windows中。我还没有尝试过，如果你是window用户，你可以先试试，如果这些方法确实有效，那么你可以下载源(`*.tar.gz`)。\n",
    "\n",
    "在下载任意的新库后，首先应该尝试(linux),\n",
    "```\n",
    ">>> sudo pip install /path/to/*.tar.gz\n",
    "```\n",
    "\n",
    "如果这个奏效了，那么安装就简单了。\n",
    "\n",
    "现在，解压下载下来的`*.tar.gz`文件。如果有`setup.py`文件在这个目录中，那么你应该运行下面的命令(之后进入文件夹)，\n",
    "\n",
    "```\n",
    ">>> sudo python setup.py install\n",
    "```\n",
    "\n",
    "如果这个失败了，或者没有`setup.py`文件，那么你应该阅读`readme`或`install`文件。至少他们中的一个会告诉你，如何安装这个库。在`basemap`库的情况中，我们看到在这一部分给出了一些指导，'install'在文件`README`中。它说首先我们需要安装`geos`库，并说我们可以通过在`basemap`目录下的`geos`的子目录来安装，并发布以下命令:\n",
    "\n",
    "```\n",
    ">>> sudo make\n",
    ">>> sudo make install\n",
    "```\n",
    "\n",
    "现在，`geos`库已经安装好了，你可以回到`basemap`目录，然后通过发出以下的命令安装它:\n",
    "\n",
    "```\n",
    ">>> sudo python setup.py install\n",
    "```"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
